home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / amos / eaissu3b.lha / Source_Code / UN_Fractal_Surfaces.AMOS / UN_Fractal_Surfaces.amosSourceCode
AMOS Source Code  |  1995-12-30  |  1KB  |  59 lines

  1. ' ******** 
  2. ' SURFACES 
  3. ' ******** 
  4. BEGIN:
  5.   SX#=320
  6.   SY#=256
  7.   RATIO#=1.5
  8.   HY#=SY#/2
  9.   HX#=SX#/2
  10.   S#=Sqr(2)/2
  11.   AA#=HX#*S#
  12. Do 
  13. Cls 
  14. Print "SURFACES"
  15. Print 
  16. Print "1. Z = cos(R)"
  17. Print 
  18. Print "2. Z = exp(-R*R)"
  19. Print 
  20. Print "3. Z = sin(R)/R"
  21. Print 
  22. Print "   where R = sqr(X*X + Y*Y)"
  23. Print 
  24. Print "4. Z = cos(X)*cos(Y)"
  25. Print 
  26. Print "5. The Monkey Saddle"
  27. Print 
  28. Print "type in the number of the equation"
  29. Print "(0 to quit)"
  30. Print 
  31. Input N
  32. If N=0 Then Edit 
  33. Cls 
  34.   MAINLOOP:
  35.     For A#=-AA# To AA#+5*S#
  36.     _MAX#=-HY#
  37.     BB#=AA#+A#-10*S#*Int((A#+Abs(A#))/(10*S#))
  38.     For B#=-BB# To BB#+S#*4 Step 10*S#
  39.     X#=S#*(A#+B#)
  40.     Y#=S#*(B#-A#)
  41.     Z#=B#
  42.     R#=Sqr(X#*X#+Y#*Y#)
  43.     If N=1 Then Z#=10*Cos(R#/5)+B#
  44.     If N=2 Then Z#=75*Exp(-R#*R#/600)+B#
  45.     If N=3 and R#<>0 Then Z#=125*Sin(R#/5)/R#+B#
  46.     If N=4 Then Z#=10*Cos(X#/10)*Cos(Y#/10)+B#
  47.     If N=5 and R#<>0 Then Z#=X#*Y#*(X#-Y#)*(X#+Y#)/(1000*R#)+B#
  48.     If Z#<_MAX# Then Goto _NEXTLINE
  49.     _MAX#=Z#
  50.     U#=HX#+A#
  51.     V#=HY#+Z#*S#/RATIO#
  52.     If V#<0 or V#>SY# Then Goto _NEXTLINE
  53.     Plot U#,SY#-V#
  54.   _NEXTLINE:
  55.     Next B#
  56.     Next A#
  57. Wait Key 
  58. Loop 
  59. FINITO: